#ifndef _LUA_DELGATE_H_
#define _LUA_DELGATE_H_

#include "LuaHandler.h"
#include <vector>
#include <memory>

class LuaDelegate
{
public:
	int addScriptHandler(int handler);
	void removeScriptHandler(int handler);
	void clearScriptHandler();
	void merge_handlers();

	typedef std::vector< std::shared_ptr<LuaHandler> > LuaHandlerVector;

	LuaHandlerVector mHandlers;
};

#define LUA_SUFFIX       0
#define LUA_TEMPLATE
#define LUA_TEMPLATE_PARAMS
#define LUA_TEMPLATE_ARGS
#define LUA_PARAMS
#define LUA_ARGS
#define LUA_TEMPLATE

#include "LuaDelegateImp.h"

#define LUA_SUFFIX       1
#define LUA_TEMPLATE_PARAMS  <typename TP1>
#define LUA_TEMPLATE_ARGS    <TP1>
#define LUA_TEMPLATE_TYPES	TP1
#define LUA_PARAMS       TP1 p1
#define LUA_ARGS         p1
#define LUA_TEMPLATE	template

#include "LuaDelegateImp.h"

#define LUA_SUFFIX       2
#define LUA_TEMPLATE_PARAMS  <typename TP1,typename TP2>
#define LUA_TEMPLATE_ARGS    <TP1, TP2>
#define LUA_TEMPLATE_TYPES   TP1, TP2
#define LUA_PARAMS       TP1 p1, TP2 p2
#define LUA_ARGS         p1, p2
#define LUA_TEMPLATE	template

#include "LuaDelegateImp.h"

#define LUA_SUFFIX       3
#define LUA_TEMPLATE_PARAMS  <typename TP1,typename TP2,typename TP3>
#define LUA_TEMPLATE_ARGS    <TP1, TP2, TP3>
#define LUA_TEMPLATE_TYPES   TP1, TP2, TP3
#define LUA_PARAMS       TP1 p1, TP2 p2, TP3 p3
#define LUA_ARGS         p1, p2, p3
#define LUA_TEMPLATE	template

#include "LuaDelegateImp.h"

#define LUA_SUFFIX       4
#define LUA_TEMPLATE_PARAMS  <typename TP1,typename TP2,typename TP3, typename TP4>
#define LUA_TEMPLATE_ARGS    <TP1, TP2, TP3, TP4>
#define LUA_TEMPLATE_TYPES   TP1, TP2, TP3, TP4
#define LUA_PARAMS       TP1 p1, TP2 p2, TP3 p3, TP4 p4
#define LUA_ARGS         p1, p2, p3, p4
#define LUA_TEMPLATE	template

#include "LuaDelegateImp.h"

#define LUA_SUFFIX       5
#define LUA_TEMPLATE_PARAMS  <typename TP1,typename TP2,typename TP3, typename TP4, typename TP5>
#define LUA_TEMPLATE_ARGS    <TP1, TP2, TP3, TP4, TP5>
#define LUA_TEMPLATE_TYPES   TP1, TP2, TP3, TP4, TP5
#define LUA_PARAMS       TP1 p1, TP2 p2, TP3 p3, TP4 p4, TP5 p5
#define LUA_ARGS         p1, p2, p3, p4, p5
#define LUA_TEMPLATE	template

#include "LuaDelegateImp.h"

#endif //_LUA_DELGATE_H_